package com.watereast;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class TextUtil {
    public static String getFileName(String url) {
        String suffixes = "avi|mpeg|3gp|mp3|mp4|wav|jpeg|gif|jpg|png|apk|exe|pdf|rar|zip|docx|doc";
        Pattern pat = Pattern.compile("[\\w]+[\\.](" + suffixes + ")");
        Matcher mc = pat.matcher(url);
        if (mc.find())
            return mc.group();
        return "";
    }

    public static boolean isNullOrEmpty(String str) {
        return (str == null || str.trim().length() == 0);
    }
}
